#include<stdio.h>
int add(int x,int y){
    return  x+y;
}
int sub(int x,int y){
    return  x-y;
}
int mul(int x,int y){
    return  x*y;
}
float  div(int x,float y){
	return x/y;
}

int main(){
   int  n,a,b;
   float c;
   scanf("%d",&n);
   while(n--){
        getchar();
     if(scanf("add(%d,%d)",&a,&b)) {
         printf("%d\n",add(a,b));
     }
     else if(scanf("sub(%d,%d)",&a,&b)) {
         printf("%d\n",sub(a,b));
     }
     else if(scanf("mul(%d,%d)",&a,&b)) {
            printf("%d\n",mul(a,b));
     }
     else if(scanf("div(%d,%d)",&a,&b)) {
     	c=(float)b;
         if(b==0)
            printf("error\n");
         else{
         if(a%b==0)
            printf("%.0f\n",div(a,b));
         else
            printf("%.2f\n",div(a,c));
         }

     }
   }
 return 0;
}
